/**
 * Created by zl on 16/10/31.
 */

import Vue from 'vue'
import VueRouter from 'vue-router'
import {configRouter} from '../frame/routeConfig'
Vue.use(VueRouter)

let appRouter = new VueRouter({
  hashbang: true
})

configRouter(appRouter)

//Object.defineProperty(appRouter, 'vm', { get: function () { return this.app } })

appRouter.afterEach(function () {
  let MyComponent = Vue.extend({
    template: `<div style="width: 100%;height: 100%;background: transparent; position: relative; z-index: 5003;display: block;"></div>`
  })
  new MyComponent({
    el: '#routerMask'
  })

  setTimeout(
    () => {
      let MyComponent = Vue.extend({
        template: `<div style="display: none;"></div>`
      })
      new MyComponent({
        el: '#routerMask'
      })
    }, 500
  )
})

export {
  appRouter
}
